function count() {
    var d = cm.getMap().getReactorByName("box1").getState();
    var c = cm.getMap().getReactorByName("box2").getState();
    var b = cm.getMap().getReactorByName("box3").getState();
    var a = 0;
    if (d == 0 && c == 1 && b == 0) {
        a++;
        cm.getMap().getReactorByName("light1").forceHitReactor(null, 1, 431, -277, 0)
    } else {
        cm.getMap().getReactorByName("light1").forceHitReactor(null, 1, 431, -277, 0)
    }
    if (d == 0 && c == 1) {
        a++;
        cm.getMap().getReactorByName("light2").forceHitReactor(null, 1, 568, -360, 0)
    } else {
        cm.getMap().getReactorByName("light2").forceHitReactor(null, 0, 568, -360, 0)
    }
    if (b == 0) {
        a++;
        cm.getMap().getReactorByName("light3").forceHitReactor(null, 1, 779, -274, 0)
    } else {
        cm.getMap().getReactorByName("light3").forceHitReactor(null, 0, 779, -274, 0)
    }
    cm.getMap().getReactorByName("light3").forceHitReactor(null, 0, 779, -274, 0);
    cm.getMap().getReactorByName("eye").forceHitReactor(null, a == 3 ? 1 : 0, 510, -291, 0);
    cm.getMap().getReactorByName("graph").forceHitReactor(null, a, 560, -169, 0);
    return a
}

function act() {
    var a = count();
    if (a == 3) {
        cm.openScriptNpc()
    }
}
var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(d, c, b) {
    if (status == 0 && d == 0) {
        cm.dispose();
        return
    }(d == 1) ? status++ : status--;
    selectionLog[status] = b;
    var a = -1;
    if (status <= a++) {
        cm.dispose()
    } else {
        if (status === a++) {
            cm.curNodeEventEnd(true);
            cm.setInGameDirectionMode(true, false, true);
            cm.inGameDirectionEvent_PushScaleInfo(0, 1500, 0, 610, -100)
        } else {
            if (status === a++) {
                cm.updateInfoQuest(33240, "skip6=1;skip8=1;switch=1;act5=350053300");
                cm.fieldEffect_PlayFieldSound("Sound/SoundEff.img/blackHeaven/mOn", 100);
                cm.inGameDirectionEvent_AskAnswerTime(1500)
            } else {
                if (status === a++) {
                    cm.inGameDirectionEvent_PushScaleInfo(0, 1500, 0, 1200, 0)
                } else {
                    if (status === a++) {
                        cm.inGameDirectionEvent_AskAnswerTime(600)
                    } else {
                        if (status === a++) {
                            cm.npc_SetSpecialAction("oid=1540703", "on", -1, 1);
                            cm.fieldEffect_PlayFieldSound("Sound/SoundEff.img/blackHeaven/btOpen", 100);
                            cm.inGameDirectionEvent_AskAnswerTime(1000)
                        } else {
                            if (status === a++) {
                                cm.sendNormalTalk_Bottom("都弄好了！快按下按钮吧。", 37, 1540490, false, true)
                            } else {
                                if (status === a++) {
                                    cm.updateInfoQuest(33236, "start=1");
                                    cm.cameraSwitch_CameraSwitchBack();
                                    cm.inGameDirectionEvent_PushMoveInfo(1, 1000, 0, 0)
                                } else {
                                    if (status === a++) {
                                        cm.inGameDirectionEvent_AskAnswerTime(1000)
                                    } else {
                                        if (status === a++) {
                                            cm.setInGameDirectionMode(false, true, false);
                                            cm.dispose()
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
};